#version 330

in vec2 fragTexCoord;
in vec3 fragPosition;
in vec3 fragNormal;

uniform sampler2D texture0;
uniform vec4 colDiffuse;
uniform vec4 wall;
uniform float me;
uniform vec2 ab_point;

out vec4 finalColor;

float fen(vec2 pointA, vec2 pointB) {
    // 计算向量
    vec2 AB = pointB - pointA;
    vec2 AP = fragTexCoord - pointA;
    
    // 使用叉积判断点在直线的哪一侧
    return AB.x * AP.y - AB.y * AP.x;
}

void main()
{
    vec4 texelColor = texture(texture0, fragTexCoord);
    
    // 基础颜色
    vec3 baseColor = texelColor.rgb * colDiffuse.rgb;
    
    // 如果不是墙，使用基础颜色
    if (me > 0.5) {
        finalColor = vec4(0.,0.,0., texelColor.a);
        return;
    }

    finalColor = vec4(baseColor,1);
    
    
}